/*
 * Manager.cpp
 *
 *  Created on: 2011/06/11
 *      Author: naoki
 */

#include "NTEngine/NTEngine.h"
#include "NTEngine/Threading/Manager.h"
#include "NTEngine/Core/Core.h"

#include "Threading/src/ManagerImpl.h"

namespace NTEngine {
namespace Threading {

ManagerImpl* gManagerImpl = 0;

Manager::Manager() {
	ASSERT( Core::isMainThread() && "you must call from MAIN thread" );
}

Manager Manager::instance() {
	return Manager();
}

int Manager::getCoreNumber() const {
	return gManagerImpl->getCoreNumber();
}

void Manager::create( int addThreadNumber ) {
	HARD_ASSERT( gManagerImpl == NULL );
	gManagerImpl = NEW ManagerImpl( addThreadNumber );
}

void Manager::destroy() {
	SAFE_DELETE( gManagerImpl );
}

} // namespace Threading
} // namespace NTEngine
